-
-
Notifications
You must be signed in to change notification settings - Fork 364
refactor(Table): table display value use LookupService #4935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-Authored-By: Silver <[email protected]>
Co-Authored-By: Silver <[email protected]>
# Conflicts: # src/BootstrapBlazor/BootstrapBlazor.csproj
Reviewer's Guide by SourceryThis pull request refactors the Table component to use the LookupService for displaying values. Sequence diagram for table value lookup processsequenceDiagram
participant T as Table
participant LC as LookupContent
participant LS as LookupService
T->>LC: Create with value and lookup config
activate LC
LC->>LS: GetItemsAsync(key, data)
activate LS
LS-->>LC: Return lookup items
deactivate LS
LC->>LC: Find matching item
LC-->>T: Render lookup text
deactivate LC
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| private string? _content; | ||
|
|
||
| private List<SelectedItem>? _items; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Consider refreshing lookup items when parameters change
The current caching of _items might cause stale data if LookupService or LookupServiceData changes. Consider clearing _items when these parameters change to ensure fresh data.
Suggested implementation:
private string? _content;
private List<SelectedItem>? _items;
private ILookupService? _previousLookupService;
private object? _previousLookupServiceData;
/// <summary>
/// Method invoked when the component has received parameters from its parent in
/// the render tree, and the incoming values have been assigned to properties.
/// </summary>
protected override void OnParametersSet()
{
base.OnParametersSet();
// Check if LookupService or LookupServiceData have changed
if (!ReferenceEquals(_previousLookupService, LookupService))
{
_items = null;
_previousLookupService = LookupService;
}
}
/// <summary>Note: Since I can't see the full file, you'll need to:
- Make sure the class inherits from ComponentBase (which provides OnParametersSet)
- If LookupServiceData is a parameter, add similar change detection for it in OnParametersSet
- Verify this doesn't conflict with any existing parameter change handling
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4935 +/- ##
===========================================
- Coverage 100.00% 99.99% -0.01%
===========================================
Files 620 629 +9
Lines 27333 28119 +786
Branches 3921 4049 +128
===========================================
+ Hits 27333 28118 +785
- Partials 0 1 +1 ☔ View full report in Codecov by Sentry. |
table display value use LookupService
Summary of the changes (Less than 80 chars)
简单描述你更改了什么, 不超过80个字符;如果有关联 Issue 请在下方填写相关编号
Description
fixes #4931
Regression?
[If yes, specify the version the behavior has regressed from]
[是否影响老版本]
Risk
[Justify the selection above]
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Use LookupService to display values in tables.
New Features:
Tests: